<?php
namespace app\index\controller;
use think\Controller;
use think\Db;
use think\Request;
use think\Session;

class ActivityList extends Common
{
    public function index()
    {
        $time=date('Y-m-d H:i:s');
        $type=$this->request->param('type');
        $list=array();
        $title='';
        if($type==1)
        {
            $sql1="select * from tp_activity where start_time>'$time' and type ='a' and status=1 and isdelete=0";
            $list=Db::query($sql1);
            $title='学生活动';
        }
        else if($type==2)
        {
            $sql2="select * from tp_activity where start_time>'$time' and type='b' and status=1 and isdelete=0";
            $list=Db::query($sql2);
            $title='学术讲座';
        }
        else if($type==5)
        {
            $sql3="select * from tp_work where end_time>'$time' and status=1 and isdelete=0";
            $list=Db::query($sql3);
            $title='信息资讯';
        }
        else if($type==4)
        {
            $sql4="select * from tp_notice where status=1 and isdelete=0";
            $list=Db::query($sql4);
            $title='重要通知';
        }
        $this->view->assign('list',$list);
        $this->view->assign('title',$title);
        $this->view->assign('type',$type);
        return view();
    }
}
